<!doctype html>
<!--
Copyright 2013 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
  <head>
    <meta charset="utf-8"/>
    <title>Kratu Spaceship Selector</title>
    <link rel="stylesheet" href="../../css/kratu.css">
    <link rel="stylesheet" href="../../css/examples.css">
    <script src='../../js/kratu.js'></script>
    <script src='../../js/dataproviders/csv.js'></script>
    <script src='../../js/dataproviders/json.js'></script>
    <script type="text/javascript">
      /** Render a Kratu report showcasing the AdWords HealtCheck Example */
      window.onload = function() {
        'use strict';
        var csvProvider = new KratuCSVProvider();
        csvProvider.load('./spaceships_data.csv', function(spaceships) {
          // Instantiate a new Kratu object
          var kratu = new Kratu();

          // Give Kratu our spaceships
          kratu.setEntities(spaceships);

          // Tell Kratu where to render our report
          kratu.setRenderElement(document.getElementById('kratuReport'));

          var jsonProvider = new KratuJsonProvider({forceReload: true});
          jsonProvider.load('./spaceships_reportdefinition.json',
            function(reportDefinition) {
              kratu.setReportDefinition(reportDefinition, function() {
                // And render it!
                kratu.renderReport();
            });
          });
        });
      };
    </script>
</head>
  <body>
    <div class="kratuLogo small"><a href="">k</a><span>powered by</span></div>
    <h1>Kratu Spaceship Selector</h1>
    <div id="kratuReport"></div>
    <div class='credits'>
      Spaceship models courtesy of <a href="http://www.egoant.com/blog/8-News/92-free-space-sprites.html">Aaron Clifford</a><br>
      Spaceship names courtesy of <a href="http://chaoticshiny.com/sshipgen.php">ChaoticShiny.com</a><br>
    </div>
  </body>
</html>
